﻿using System;
using System.Linq.Expressions;
using Domain.Core.Specification;
using Domain.MainModule.Entities;

namespace Domain.MainModule.Rates
{
    public class RateCountryIdSpecification : Specification<Rate>
    {
        #region public properties

        public Guid CountryId
        {
            get;
            set;
        }

        #endregion

        #region constructor

        public RateCountryIdSpecification(Guid countryId)
        {
            this.CountryId = countryId;
        }

        #endregion

        #region public methods

        public override Expression<Func<Rate, bool>> SatisfiedBy()
        {
            Specification<Rate> spec = new TrueSpecification<Rate>();
            spec &= new DirectSpecification<Rate>(c => c.CountryId == this.CountryId);

            return spec.SatisfiedBy();
        }

        #endregion
    }
}
